// 使用弹框，封装弹框常用方法
import {reactive} from "vue";
import type {DialogModel} from "../type/BaseType.ts";

export default function useDialog(){
    // 定义弹框属性
    const dialog = reactive<DialogModel>({
        title:'',
        visible:false,
        width:630,
        height:280
    })

    // 关闭弹窗
    const onClose = () => {
        dialog.visible = false;
    }

    // 展示弹窗
    const onShow = () => {
        dialog.visible = true
    }

    // 确认(确认后肯定要关闭弹框的)
    const onConfirm = () => {
        dialog.visible = false
    }

    return {
        dialog,
        onClose,
        onShow,
        onConfirm
    }
}